﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Xpus.YouYTube.Data;

namespace Xpus.YouYTube.WebSite.Controllers
{
	public class HomeController : Controller
	{
		public ActionResult Index()
		{
			using (TDataContext db = new TDataContext())
			{
				var qNewVideos = from v in db.TVideoWithCommentNumbers
								 where v.IsDeleted == false
								 orderby v.AddedTime descending
								 select v;
				ViewData["NewVideos"] = qNewVideos.Take(50).ToArray();

				return View("HomeIndex");
			}
		}
	}
}
